namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0153 : DbMigration
    {
        public override void Up()
        {
            DropPrimaryKey("dbo.SysUserLoginLogout");
            DropPrimaryKey("dbo.SysUserLoginMonitor");
            AddColumn("dbo.SysUserLoginLogout", "UserLoginLogoutId", c => c.Int(nullable: false, identity: true));
            AddColumn("dbo.SysUserLoginMonitor", "UserLoginMonitorId", c => c.Int(nullable: false, identity: true));
            AlterColumn("dbo.SysUserLoginLogout", "UserId", c => c.Int());
            AlterColumn("dbo.SysUserLoginLogout", "ClientIp", c => c.String());
            AlterColumn("dbo.SysUserLoginLogout", "SystemId", c => c.String());
            AlterColumn("dbo.SysUserLoginMonitor", "ClientIp", c => c.String());
            AlterColumn("dbo.SysUserLoginMonitor", "SystemId", c => c.String());
            AddPrimaryKey("dbo.SysUserLoginLogout", "UserLoginLogoutId");
            AddPrimaryKey("dbo.SysUserLoginMonitor", "UserLoginMonitorId");
        }
        
        public override void Down()
        {
            DropPrimaryKey("dbo.SysUserLoginMonitor");
            DropPrimaryKey("dbo.SysUserLoginLogout");
            AlterColumn("dbo.SysUserLoginMonitor", "SystemId", c => c.String(nullable: false, maxLength: 128));
            AlterColumn("dbo.SysUserLoginMonitor", "ClientIp", c => c.String(nullable: false, maxLength: 128));
            AlterColumn("dbo.SysUserLoginLogout", "SystemId", c => c.String(nullable: false, maxLength: 128));
            AlterColumn("dbo.SysUserLoginLogout", "ClientIp", c => c.String(nullable: false, maxLength: 128));
            AlterColumn("dbo.SysUserLoginLogout", "UserId", c => c.Int(nullable: false));
            DropColumn("dbo.SysUserLoginMonitor", "UserLoginMonitorId");
            DropColumn("dbo.SysUserLoginLogout", "UserLoginLogoutId");
            AddPrimaryKey("dbo.SysUserLoginMonitor", new[] { "UserId", "ClientIp", "SystemId" });
            AddPrimaryKey("dbo.SysUserLoginLogout", new[] { "UserId", "ClientIp", "SystemId" });
        }
    }
}
